package com.lottery.ruok.lottrey.ui.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lottery.ruok.lottrey.R;
import com.lottery.ruok.lottrey.retrofitModule.response.LiuhecaiPrizeResponse;
import com.lottery.ruok.lottrey.ui.component.BaseRelativeLayout;

import java.util.ArrayList;

import butterknife.BindView;


/**
 * 香港六合彩headView
 */
public class LiuhecaiHeadView extends BaseRelativeLayout {

   @BindView(R.id.issue)
   TextView issue;
   @BindView(R.id.points)
   TextView points;
   @BindView(R.id.container)
   LinearLayout container;


    public LiuhecaiHeadView(Context context) {
        super(context);
    }

    public LiuhecaiHeadView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public LiuhecaiHeadView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void init(Context context, AttributeSet attrs, int defStyleAttr) {

    }

    @Override
    protected void initView(Context context) {
        setContentView(R.layout.liuhecai_head_layout);
    }

    @Override
    protected void load(Context context) {

    }

    public void setData(ArrayList<LiuhecaiPrizeResponse> liuhecaiPrizeResponse){
        issue.setText(liuhecaiPrizeResponse.get(0).getIssue_no() + "期开奖结果");
        if (liuhecaiPrizeResponse.get(0).getZonghe() != null) {
            String[] fen = liuhecaiPrizeResponse.get(0).getZonghe().split(",");
            if (fen.length > 0) {
                points.setText("总分" + fen[0]);
            }
        }
    }
    public void addView(View view) {
        container.addView(view);
    }
}
